<?php

class My_Action_Helper_Init extends Framework_Controller_Action_Helper_Abstract
{
    protected $_config;
    
    public function __construct()
    {
        $this->_config = Framework_Registry::get('config');
    }
    
    public function init()
    {
        $fca = $this->getActionController();
        if ($fca === null) { return; }
        
        $fca->session = Framework_Registry::get('session');
        
        // Системные переменные smarty
        $fca->view->sys_full_path   = trim($this->getRequest()->getRequestUri(), '/\\');
        $fca->view->sys_path        = trim($this->getRequest()->getServer('REDIRECT_URL'), '/\\');
        $fca->view->sys_action_path = trim($this->_config->www->baseurl, '/\\')
                                        . '/' . $this->getRequest()->getControllerName()
                                        . '/' . $this->getRequest()->getActionName();
        $fca->view->sys_controller  = $this->getRequest()->getControllerName();
        $fca->view->sys_action      = $this->getRequest()->getActionName();
        
        $fca->view->width           = $fca->session->get('width');
    }
}